library(tidyverse)
## ── Attaching packages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.2.1 ✓ purrr 0.3.3
## ✓ tibble 2.1.3 ✓ dplyr 0.8.4
## ✓ tidyr 1.0.2 ✓ stringr 1.4.0
## ✓ readr 1.3.1 ✓ forcats 0.4.0
## ── Conflicts ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
library(DT)
SNPs<- read.table("/Users/nate/Desktop/R:Python/R Studio/23andMe_complete.txt", header = TRUE, sep = "\t")
SNPs$chromosome = ordered(SNPs$chromosome, levels=c(seq(1, 22), "X", "Y", "MT"))
Exercise 1: Add title and labels for the x and y axis to Lab3 ex1. Color the bars blue
newGraph1 <- ggplot(data = SNPs) + geom_bar(mapping = aes(x = chromosome), fill = "blue") + ggtitle("Ave SNP Count for each Human Chromosome") + xlab("Chromosome Name") + ylab("Total Number of SNPs")
newGraph1

Exercise 2: To Lab3 ex3 add more defined x and y axis labels, add a title, Change the colors of the genotypes, so that the dinucleotides (e.g. AA) are one color, the mononucleotides (A) are another and D’s and I’s a third color. One way to do this is to specify the color of each genotype.
table1 <- c("AA" = "blue", "AC" = "blue", "AG" = "blue", "AT" = "blue", "CC" = "blue", "CG" = "blue", "CT" = "blue", "GG" = "blue", "GT" = "blue", "TT" = "blue",
"A" = "red", "C" = "red", "G" = "red", "T" = "red",
"--" = "green", "DD" = "green", "DI" = "green", "D" = "green", "II" = "green", "I" = "green")
newGraph2 <- ggplot(data = SNPs) + geom_bar(mapping = aes(x = chromosome, fill = genotype)) +
ggtitle("Ave SNP Count for each Human Chromosome") + xlab("Chromosome Name") + ylab("Total Number of SNPs")
newGraph2 + scale_fill_manual(values = table1)

Exercise 4: For Lab3 ex6 add more defined x and y axis labels, add a title, make the x-axis for each graph readable in your final report file.
newGraph3 <- ggplot(data = SNPs) + geom_bar(mapping = aes(x = chromosome, fill = genotype), position = "dodge") + facet_wrap(~ genotype, nrow = 5) +
ggtitle("Ave SNP Count for each Human Chromosome") + xlab("Chromosome Name") + ylab("Total Number of SNPs")
newGraph3

Exercise 5: Turn Lab3 ex6 into an interactive graph using plotly
newGraph4 <- ggplot(data = SNPs) + geom_bar(mapping = aes(x = chromosome, fill = genotype), position = "dodge") + facet_wrap(~ genotype, nrow = 10)
ggplotly(newGraph4)
Exercise 6: Make an interactive table of the SNPS found in on the Y chromosome from the 23andMe_complete data set
datatable(subset(SNPs, chromosome == "Y"))
## Warning in instance$preRenderHook(instance): It seems your data is too big
## for client-side DataTables. You may consider server-side processing: https://
## rstudio.github.io/DT/server.html